﻿using DongFangGuoKai.WCSPlatform.WebApi.Controllers;
using DongFangGuoKai.WCSPlatform.WebApi.Controllers.测试;
using DongFangGuoKai.WMSPlatform.Extensions;
using Swashbuckle.AspNetCore.SwaggerUI;

namespace DongFangGuoKai.WCSPlatform.WebApi.Extensions
{
    public static class WebApplicationExtensions
    {
        public static void UseInitSwagger(this WebApplication app)
        {
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                foreach (string version in typeof(ApiVersions).GetEnumNames())
                {
                    c.SwaggerEndpoint($"/swagger/{version}/swagger.json", $"东方国际-杭州计量院WCS系统第【{version}】版本");
                    c.RoutePrefix = "swagger";//路径

                    // 启用请求持续时间的显示
                    c.DisplayRequestDuration();

                    // 其他配置...
                    c.DocumentTitle = "WCS接口文档";

                    //c.DocExpansion(DocExpansion.Full); 展开
                }
            });
        }
    }
}
